package com.cn.zy.hr.redis.dao;

import com.cn.zy.hr.redis.entity.UserInfoEntity;
import org.apache.ibatis.annotations.Update;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author zhangyi
 * @date 2018/11/28 18:55
 */
@Repository
@Transactional(rollbackFor = Exception.class)
public interface UserDao extends JpaRepository<UserInfoEntity,Long>,CrudRepository<UserInfoEntity,Long> {


    @Query(value = "UPDATE test_user set user_name = ?2 , pass_word = ?3 where id = ?1",nativeQuery = true)
    @Modifying
    int updateUser(Long id, String userName, String password);
}